import { ElNotification } from 'element-plus';
import debounce from './debounce';
let notification = null;
/**
 * 消息通知
 * @param {String} title 标题
 * @param {String} message 通知栏正文内容
 * @param {String} type 'success' | 'warning' | 'info' | 'error' | ''
 */
let showNotification = function ({ title, message, type }) {
	debounce(() => {
		// 如果已有通知，则关闭它
		if (notification) {
			notification.close();
		}
		// 创建新的通知
		notification = ElNotification({
			title,
			message,
			type,
		});
	},500,true)

}

export default showNotification